<!DOCTYPE html>
<html>
<head>
    <% include ../common/meta.ejs %>
    <% include ../common/public.ejs %>
    <style type="text/css">
        .input-group-addon {
            padding: 5px 12px;
        }
    </style>
</head>
<body>
<% include ../common/header.ejs %>

<div class="container">
    <div class="dolphin-row main page-content">
        <div class="page-header">
            <h5 class="content-title">数据权限</h5>
            <div class="pull-left">
                <ul class="fl">
                    <li>
                        <button class="btn btn-block btn-info newEnum"><i class="fui-plus-circle icon-menu"></i></i>
                            <span>新建权限</span>
                        </button>
                    </li>
                </ul>
            </div>
        </div>

        <div class="dolphin-col-24">
            <div class="row">
                <div class="col-md-6">
                    <div id="enumList"></div>
                </div>
                <div class="col-md-6">
                    <div id="enumItemList"></div>
                </div>
            </div>
        </div>
    </div>
</div>

<div class="modal fade" id="dataModal" tabindex="-1" role="dialog" aria-labelledby="dataModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">

            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                            aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="dataModalLabel">数据权限维护</h4>

            </div>
            <div class="modal-body">
                <div>
                    <!-- Nav tabs -->
                    <ul class="nav nav-tabs" role="tablist">
                        <li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab"
                                                                  data-toggle="tab">用户信息</a></li>
                    </ul>
                    <!-- Tab panes -->
                    <div class="tab-content">
                        <div role="tabpanel" class="tab-pane active" id="home">
                            <form class="form-horizontal edit-form">
                                <!--隐藏域存放公寓信息-->
                                <input type="hidden" class="form-control" id="userId" name="id">
                                <input type="hidden" class="form-control" id="id" name="apartmens.id">
                                <input type="hidden" class="form-control" id="name" name="apartmens.name">

                                <div class="form-group">
                                    <label class="col-md-2 control-label">用户名称</label>
                                    <div class="col-md-4">
                                        <div class="input-group">
                                            <input type="text" class="form-control" name="name" id="contactName" dol-validate="required" readonly>
                                            <span class="input-group-addon" id="selectUser"><i class="glyphicon glyphicon-search"></i></span>
                                        </div>
                                    </div>
                                    <label class="col-md-2 control-label">联系电话</label>
                                    <div class="col-md-4">
                                        <input class="form-control" id="contactMobile" name="mobile" disabled type="text" dol-validate="required">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="orderRelStr">
                                        <label class="col-md-2 control-label">添加公寓</label>
                                        <select id="selectHouse" style="width:200px;" class="js-example-basic-multiple" multiple="multiple" >
                                                <option value="">请选择</option>
                                        </select>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary modelSave">确定</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>

<!--用户选择器-->
<div class="modal fade" id="userModal" tabindex="-1" role="dialog" aria-labelledby="userModalLabel">
    <div class="modal-dialog" role="document" style="left: 12%;top: 0;width: 80%;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                            aria-hidden="true">&times;</span></button>
                <span class="modal-title">用户选择器</span>
            </div>
            <div class="modal-body">
                <div class="queryCondition">
                    <form class="query-user-form">
                        <div class="row">
                            <div class="col-md-10">
                                <label>用户姓名：</label>
                                <input type="text" placeholder="支持模糊查询" name="name_like">
                                <label>联系方式：</label>
                                <input type="text" placeholder="支持模糊查询" name="mobile_like">
                                <button class="btn btn-sm btn-inverse btn-query" id="queryUser" type="button">查询</button>
                            </div>

                        </div>
                    </form>
                </div>
                <div id="userList" class="box-content"></div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary confirmUser">确定</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>


<% include ../common/footer.ejs %>
<script type="text/javascript">
    $('.js-example-basic-multiple').select2();

    //获得所有的公寓信息
    Dolphin.ajax({
        url: '/api/99bcc6d2efca4b50bce3dabb85f990e4',
        type: Dolphin.requestMethod.POST,
        onSuccess: function (reData) {
            console.log(reData);
            for(var j=0;j<reData.rows.length;j++){
                console.log(reData[j]);
                $('#selectHouse').append("<option value='"+reData.rows[j].id+"'>"+reData.rows[j].name+"</option>");
            }
        }
    });

</script>
</body>
</html>
